package com.matou.auth.controller;

import com.matou.auth.service.ValidateCodeService;
import com.matou.commons.exception.ValidateCodeException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author CM
 * @Date 2021/5/10 9:46
 * @Description SecurityController
 * @Version 1.0
 */
@Controller
public class SecurityController {
    @Autowired
    private ValidateCodeService validateCodeService;

    /**
     * 获取图片校验码
     * @param request
     * @param response
     * @throws IOException
     * @throws ValidateCodeException
     */
    @GetMapping("captcha")
    public void captcha(HttpServletRequest request, HttpServletResponse response) throws IOException, ValidateCodeException {
        validateCodeService.create(request, response);
    }
}
